According to the World Health Organization, every year, about 800,000 people die due to suicide. In this project, we are wondering the trend of suicide rate across years.
The main dataset for our project is a combined dataset from summary datasets made by United Nations Development Program, World Bank, Kaggle, and World Health Organization. It can be access at here. The dataset has a size of 27660 observations and 11 features. Features include:
Before 1995, the suicide rate at the global level is increasing, but since then, it keeps decreasing.
We found that surprisingly, male has higher rate of suicide than female since 1985. Female suicide rate has a very stable trend throughout the history, while there were dramatic changes for male.
p <- maindata%>%
group_by(year, sex) %>%
summarize(suicide_per_100k = (sum(as.numeric(suicides_no)) / sum(as.numeric(population))) * 100000) %>%
ggplot(aes(x = year, y = suicide_per_100k, col = factor(sex))) +
geom_line() +
geom_point() +
labs(title = "Trends Over Time, by Sex",
x = "Year",
y = "Suicides per 100k",
color = "Sex") +
scale_x_continuous(breaks = seq(1985, 2015, 5), minor_breaks = F)
p + transition_reveal(year)
Suicide rates for the youngest age group nearly constant and low over time. As the graph shown, elder groups have had higher suicide rate since 1985, and surprisingly such trend has not changed once.
p <- maindata %>% group_by(year, age) %>%
summarize(suicide_per_100k = (sum(as.numeric(suicides_no)) / sum(as.numeric(population))) * 100000) %>%
ggplot(aes(year, suicide_per_100k, fill = age)) +
geom_density(stat = "identity",alpha=0.2) +
labs(y = "Suicide rate", title = "Suicide rates across age group over time")
p
GDP has been viewed as a good measure about the development of a country. However, graph below shows that there are no obvious trend between GDP and suicide rate. Although GDPs across the world have been shifted toward larger direction, such trend persists.
suicide_sub<-maindata %>% select(country,year,sex,suicides_no)
n<-unique(suicide_sub$country)
country<-function(x){
suicide2<-suicide_sub %>% filter(country==x)
sum(suicide2$suicides_no)
}
country_total<-sapply(n,function(x) country(x))
df<-do.call(rbind,Map(data.frame,Country=n,Total_Suicides=country_total))
df2<-df %>% arrange(desc(Total_Suicides))
df3<-head(df2,n=10)
top_suicide<-suicide_sub %>% filter(country==c('Russian Federation',
'United States',
'Japan','France',
'Ukraine',
'Germany',
'Republic of Korea',
'Brazil',
'Poland',
'United Kingdom'))
top_suicide2<-top_suicide
top_suicide2$sex<-as.factor(top_suicide2$sex)
sm3<-aggregate(suicides_no~country+year,top_suicide2,sum)
sm4<-sm3 %>% group_by(year) %>% mutate(rank = min_rank(-suicides_no) * 1) %>%
ungroup()
static_plot<-ggplot(sm4,aes(rank,group=country,fill=as.factor(country),color=as.factor(country))) +
geom_tile(aes(y = suicides_no/2,height = suicides_no, width = 0.9), alpha = 0.8, color = NA) +
geom_text(aes(y = 0, label = paste(country, ' ')), vjust = 0.2, hjust = 1) +
geom_text(aes(y=suicides_no,label = paste(' ',suicides_no)), hjust=0)+
coord_flip(clip = 'off', expand = TRUE) +
scale_y_continuous(labels = scales::comma) +
scale_x_reverse() +
guides(color = FALSE, fill = FALSE) +
theme_minimal() +
theme(
plot.title=element_text(size=25, hjust=0.5, face='bold', colour='grey', vjust=-1),
plot.subtitle=element_text(size=18, hjust=0.5, face='italic', color='grey'),
plot.caption =element_text(size=8, hjust=0.5, face='italic', color='grey'),
axis.ticks.y = element_blank(),
axis.text.y = element_blank(),
plot.margin = margin(1,1,1,4, 'cm')
)
plt<-static_plot + transition_states(states = year, transition_length = 4, state_length = 1) +
ease_aes('cubic-in-out') +
#view_follow(fixed_x = TRUE) +
labs(title = 'Total Suicides per Year : {closest_state}',
subtitle = 'Top 10 Countries',
caption = 'Data Source: World Bank Data',
x='Countries',y='Total Suicides per year')
final_animation<-animate(plt,100,fps = 20,duration = 30, width = 950, height = 750, renderer = gifski_renderer())
final_animation